#include <allegro.h>
#include <stdlib.h>

void docircle(BITMAP *bmp, int x, int y, int color){
    putpixel(bmp, x ,y ,color);
    putpixel(bmp, x+1,y+1, color);
    rest(1);
}

int main(void){

    int x,y,radius;
    int red,green,blue,color;

    allegro_init();
    install_keyboard();
    install_timer();

    int ret = set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0);
    if(ret != 0){
        allegro_message(allegro_error);
        return 1;
    }

    textprintf_ex(screen,font,0,0,15,-1,"DoCircle Program - %dx%d - press ESC to quit.", SCREEN_W, SCREEN_H);

    while(!key[KEY_ESC]){
        y = 40 + rand() % (SCREEN_H-80);
        x = 40 + rand() % (SCREEN_W-80);
        radius = rand() % 40;

        red = rand() % 255;
        green = rand() % 255;
        blue = rand() % 255;
        color = makecol(red,green,blue);

        do_circle(screen,x,y,radius,color, *docircle);

    }
    allegro_exit();
    return 0;

}
END_OF_MAIN()
